Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let rb status controller onCreate predicate return true #5865

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

zach593
Copy link
Contributor

@zach593 zach593 commented Nov 23, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

Currently, the rb/crb status controller watchs rb/crb and work, but the predicates for creating events are all false, which means that if the work status is up to date, but the queue of the rb/crb status controller is not cleared, and it crashes, these unprocessed items will not be requeued after the next restart, and the status of rb/crb and workload will not be updated, until the relevant member cluster objects update the status again, triggering the work status controller and rb/crb status controller to process again.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmada-controller-manager`: Fixed the corner case where the reconciliation of aggregating status might be missed in case of component restart.

@karmada-bot karmada-bot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 23, 2024
@karmada-bot karmada-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 23, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 46.20%. Comparing base (8691287) to head (302d545).
Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
pkg/controllers/status/common.go 0.00% 7 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5865      +/-   ##
==========================================
- Coverage   46.32%   46.20%   -0.13%     
==========================================
  Files         661      663       +2     
  Lines       54400    54598     +198     
==========================================
+ Hits        25200    25225      +25     
- Misses      27576    27751     +175     
+ Partials     1624     1622       -2     
Flag Coverage Δ
unittests 46.20% <0.00%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/assign
Thanks for spotting. It makes sense to me.
But I will see if there is any potential side effect, basically reconciling a ResourceBinding before scheduling.

@RainbowMango
Copy link
Member

Currently, the rb/crb status controller watchs rb/crb and work, but the predicates for creating events are all false, which means that if the work status is up to date, but the queue of the rb/crb status controller is not cleared, and it crashes, these unprocessed items will not be requeued after the next restart, and the status of rb/crb and workload will not be updated

Another approach is letting the resource-binding-status-controller respond to the Work creation event. See the code here:

CreateFunc: func(event.CreateEvent) bool { return false },

Which approach do you prefer? @zach593 @chaunceyjiang @XiShanYongYe-Chang

@zach593
Copy link
Contributor Author

zach593 commented Nov 25, 2024

I think this is some kind of self-checking of rb/crb, and from this point of view, introducing more interdependencies between objects is unnecessary.
So I prefer the rb/crb creation event. @RainbowMango

@XiShanYongYe-Chang
Copy link
Member

letting the resource-binding-status-controller respond to the Work creation event.

I agree with this approach.

@XiShanYongYe-Chang
Copy link
Member

XiShanYongYe-Chang commented Nov 25, 2024

from this point of view, introducing more interdependencies between objects is unnecessary.

Hi @zach593, Are you referring to the concern that duplicate rb/crbs are being processed?

I understand that we have increased attention to the create event, the only reason is to worry about controller restart, am I right?

@RainbowMango
Copy link
Member

In my opinion, both approaches should work, considering that the number of ResourceBinding is less than the number of Works, I prefer the first one(the current PR approaches).

@XiShanYongYe-Chang Can you explain why you prefer the second approach?

@zach593 Do you think this patch would have an impact on performance?

@zach593
Copy link
Contributor Author

zach593 commented Nov 25, 2024

Are you referring to the concern that duplicate rb/crbs are being processed?

No, unually extra reconciliation should not be harmful, unless it runs into some performance issues.

I understand that we have increased attention to the create event, the only reason is to worry about controller restart, am I right?

Yes, this PR is mainly focused on controller restarts

@XiShanYongYe-Chang

@zach593
Copy link
Contributor Author

zach593 commented Nov 25, 2024

Do you think this patch would have an impact on performance?

After #5779, I think it should not. I remember in the first test report in #5779 (comment), I added a test that with this predicate return true, and basically this predicate caused no impact.

@RainbowMango

@XiShanYongYe-Chang
Copy link
Member

I end up leaning towards this way:
letting the resource-binding-status-controller respond to the RB creation event. this allows for as little reconcile as possible on the basis of solving problems.

I think this is some kind of self-checking of rb/crb, and from this point of view, introducing more interdependencies between objects is unnecessary.

But I still don't understand the meaning of the second half of the sentence.

@zach593
Copy link
Contributor Author

zach593 commented Nov 25, 2024

Our goal is to add a self-check mechanism to the status of RB. From a design perspective, when faced with multiple options, if one option can reduce dependencies on other resources, it helps clarify the boundaries between subsystems, achieving what is known as "low in coupling and high in cohesion." From this perspective, the first option is preferable.
Additionally, from a practical impact perspective, this approach also introduces fewer reconciliation operations, which is even better. @XiShanYongYe-Chang

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
@XiShanYongYe-Chang What do you say?

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 26, 2024
Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I agree.
/lgtm

@XiShanYongYe-Chang
Copy link
Member

Do we need a release note and cherry-pick it to the previous branch?

@RainbowMango
Copy link
Member

Do we need a release note and cherry-pick it to the previous branch?

No strong opinion from me. @zach593 what do you say?

I added a release notes, by the way.

@RainbowMango RainbowMango added this to the v1.12 milestone Nov 26, 2024
@zach593
Copy link
Contributor Author

zach593 commented Nov 26, 2024

cool, lgtm

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@XiShanYongYe-Chang Do you think cherry-pick is needed?

@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 26, 2024
@karmada-bot karmada-bot merged commit 7fc6935 into karmada-io:master Nov 26, 2024
18 checks passed
@XiShanYongYe-Chang
Copy link
Member

Do you think cherry-pick is needed?

According to cherry-pick, the current pr meets the standard, let me build an issue to track it.

karmada-bot added a commit that referenced this pull request Nov 27, 2024
…#5865-upstream-release-1.10

Automated cherry pick of #5865: let rb status controller onCreate predicate return true
karmada-bot added a commit that referenced this pull request Nov 27, 2024
…#5865-upstream-release-1.11

Automated cherry pick of #5865: let rb status controller onCreate predicate return true
karmada-bot added a commit that referenced this pull request Nov 27, 2024
…#5865-upstream-release-1.9

Automated cherry pick of #5865: let rb status controller onCreate predicate return true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants